
pkgname=('ruby' 'ruby-docs')
pkgver=2.5.1
_pkgver=2.5
pkgrel=2
pkgdesc="An object-oriented language for quick and easy programming"
arch=('x86_64')
url="https://www.ruby-lang.org/en/"
license=('custom')
makedepends=('gdbm' 'db' 'openssl' 'zlib' 'readline' 'tk' 'libffi'
             'doxygen' 'libyaml')
options=('!emptydirs')
source=("https://cache.ruby-lang.org/pub/ruby/${_pkgver}/${pkgname}-${pkgver}.tar.xz")
sha256sums=('886ac5eed41e3b5fc699be837b0087a6a5a3d10f464087560d2d21b3e71b754d')

build() {
  cd ${pkgname}-${pkgver}
  
  ./configure --prefix=/usr \
      --sysconfdir=/etc \
      --enable-shared \
      --disable-rpath
  make
}

package_ruby() {
  depends=('gdbm' 'db' 'openssl' 'zlib' 'readline' 'libffi' 'libyaml')
  provides=('rubygems' 'rake')
  conflicts=('rubygems' 'rake')
  optdepends=('tk: for Ruby/TK')

  cd ${pkgname}-${pkgver}
  make DESTDIR=${pkgdir} install-nodoc
  install -Dm644 COPYING ${pkgdir}/usr/share/licenses/${pkgname}/COPYING
}

package_ruby-docs() {
  pkgdesc="Documentation files for ruby"
  depends=('ruby')

  cd ruby-${pkgver}
  make -j1 DESTDIR=${pkgdir} install-doc install-capi
  install -Dm644 COPYING ${pkgdir}/usr/share/licenses/ruby-docs/LICENSE
  install -D -m644 BSDL ${pkgdir}/usr/share/licenses/ruby-docs/BSDL
}
